<?php
	class cbdtdata
	{
		public function Them($cbdt_ma = "", $cbdt_ten = "", $cbdt_tendangnhap="",$cbdt_makhau = "", $cbdt_ngaysinh = "", $cbdt_khoahoc="")
		{
			$sql = "INSERT INTO canbodaotao(cbdt_ma, cbdt_ten, cbdt_tendangnhap,cbdt_makhau,cbdt_ngaysinh,cbdt_khoahoc)
					VALUES('$cbdt_ma', '$cbdt_ten', '$cbdt_tendangnhap','$cbdt_makhau', '$cbdt_ngaysinh', '$cbdt_khoahoc')";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function CapNhat($cbdt_ma = "", $cbdt_ten = "", $cbdt_tendangnhap="",$cbdt_makhau = "", $cbdt_ngaysinh = "", $cbdt_khoahoc="")
		{
			$sql = "UPDATE canbodaotao SET cbdt_ten = '$cbdt_ten', cbdt_tendangnhap= '$cbdt_tendangnhap',cbdt_makhau = '$cbdt_makhau', cbdt_ngaysinh= '$cbdt_ngaysinh',cbdt_khoahoc = '$cbdt_khoahoc' WHERE cbdt_ma = '$cbdt_ma'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function Xoa($cbdt_ma = "")
		{
			$sql = "DELETE FROM canbodaotao WHERE cbdt_ma = '$cbdt_ma'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function LayDanhSach($cbdt_ma = "")
		{
			$sql = "SELECT * FROM canbodaotao WHERE 1";
			
			if($cbdt_ma != "")
				$sql .= " AND cbdt_ma = '$cbdt_ma'";
			
			$service = new dataservice();
			return $service->ExecuteQuery($sql);
		}
	}
?>